package com.kehutong.payfees.admin;

import com.kehutong.common.util.Token;
import com.kehutong.payfees.entity.*;
import com.kehutong.payfees.service.ChargeChooseServiceImpl;
import org.coraframework.authz.HasPermission;
import org.coraframework.inject.Inject;
import org.coraframework.json.JSONObject;
import org.coraframework.mvc.MvcAction;
import org.coraframework.mvc.http.Bean;
import org.coraframework.mvc.http.ReqMapping;
import java.io.IOException;

/**
 * 标准选用
 */
@MvcAction
@ReqMapping("/admin/charge/choose")
public class ChargeChooseAction {

	@Inject
    private ChargeChooseServiceImpl chargeChooseServiceImpl;

    /**
     * 分页加载
     * @throws Exception 
     */
    @HasPermission("charge:choose:view")
    @ReqMapping("/page")
    public Object page(JSONObject jsonObject) throws Exception {
        return chargeChooseServiceImpl.page(jsonObject);
    }

    @HasPermission("charge:choose:view")
    @ReqMapping("/get")
    public Object get(String id) {
        return chargeChooseServiceImpl.get(id);
    }

    @HasPermission("charge:choose:edit")
    @ReqMapping("/delete")
    public Object delete(String id) {
        return chargeChooseServiceImpl.delete(id);
    }

    @HasPermission("charge:choose:edit")
    @ReqMapping("/update/enable")
    public Object updateEnable(JSONObject jsonObject) {
        return chargeChooseServiceImpl.updateEnable(jsonObject);
    }

    /**
     * 按页面条件批量导出
     */
    @HasPermission("charge:choose:edit")
    @ReqMapping("/export")
    public Object download(JSONObject jsonObject) throws IOException {
        return chargeChooseServiceImpl.download(jsonObject);
    }

    @HasPermission("charge:choose:edit")
    @ReqMapping("/update/enableAll")
    public Object updateEnableAll(JSONObject jsonObject) {
        return chargeChooseServiceImpl.updateEnableAll(jsonObject);
    }

    @Bean(copy=true)
    @HasPermission("charge:choose:edit")
    @ReqMapping("/update")
    public Object update(Token token, ChargeChoose entity) throws Exception {
        return chargeChooseServiceImpl.update(token, entity);
    }

    @HasPermission("charge:choose:edit")
    @ReqMapping("/save")
    public Object save(Token token, JSONObject jsonObject) throws Exception {
        return chargeChooseServiceImpl.save(token, jsonObject);
    }

}
